<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.jimet.property.*"%>
<%@page import="com.jimet.server.*"%>
<%@page import="com.jimet.user.*"%>
<%@ include file="./jimetStartPage.jsp" %>
<%
//System.out.println(request.getQueryString());
String tokenKey			= request.getParameter(JimetConfiguration.getString("Session.TOKEN_NAME"));
JimetServerUser juser 	= JimSession.getUser();
String token 			= "";

session.removeAttribute("AUTH_MSG");

if ( tokenKey != null )
{
	String tmpToken		= (String)session.getAttribute(tokenKey);
	if ( tmpToken != null )
	{
		token	= tmpToken;
	}
}

if (token == null)
{
	session.setAttribute("AUTH_MSG","AUTH_TIMEOUT");
	%>
	
<%@page import="com.boun.beans.ApplicationLookUpBean"%>
<%@page import="com.boun.objects.AdminUser"%><script>
		window.location="<%=request.getContextPath()%>/giris";
	</script>
	<%
	return;
}
else if (token.equals(""))
{
	session.setAttribute("AUTH_MSG","AUTH_TIMEOUT");
	%>
	<script>
		window.location="<%=request.getContextPath()%>/giris";
	</script>
	<%
	return;
}
else if( !(JimSession.isValid(token)))
{
	session.setAttribute("AUTH_MSG","AUTH_TIMEOUT");
	%>
	<script>
		window.location="<%=request.getContextPath()%>/giris";
	</script>
	<%
	return;
}

AdminUser adUser	= (AdminUser)Lookup.mapSingleValueForAForeignKey(ApplicationLookUpBean.adminUsers,juser.getUserId()+"","jUserID");
String dispname		= adUser!=null?adUser.getName()+ " "+ adUser.getSurname():"";


%>

<script type="text/javascript">
	var token='<%=tokenKey%>';
</script>

